package com.pay;


import javax.servlet.Filter;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.filter.CharacterEncodingFilter;


/**
 * Created by jian.cao
 * 项目启动类
 */
@ComponentScan(basePackages="com.pay")
@SpringBootApplication
@ImportResource("classpath:spring-context/applicationContext.xml")
public class BossPortalApplication extends SpringBootServletInitializer {

	
	/**
	 * war配置
	 */
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(BossPortalApplication.class);
    }
    
    /**
     *  编码过滤器
     * @return
     */
    @Bean
    Filter characterEncodingFilter() {
        CharacterEncodingFilter filter = new CharacterEncodingFilter();
        filter.setEncoding("UTF-8");
        filter.setForceEncoding(true);
        return filter;
    }
    
    public static void main(String[] args) {
        SpringApplication.run(BossPortalApplication.class, args);
    }
}
